<form (ngSubmit)="save()" [formGroup]="form">
  <div fxLayout fxLayoutAlign="start center" mat-dialog-title>
    <span fxFlex>{{title|translate}}</span>

    <button color="warn" mat-dialog-close mat-icon-button tabindex="-1" type="button">
      <mat-icon>close</mat-icon>
    </button>
  </div>

  <mat-dialog-content fxLayout="column">

    <mat-form-field>
      <mat-label>{{'line'|translate}}</mat-label>
      <app-line-input formControlName="line"></app-line-input>
      <mat-error *ngIf="form.get('line').hasError('required')">
        {{'Validator.required'|translate}}
      </mat-error>
    </mat-form-field>

    <mat-form-field>
      <input [placeholder]="'LineMachine.item'|translate" formControlName="item" matInput required type="number">
      <mat-error *ngIf="form.get('item').hasError('required')">
        {{'Validator.required'|translate}}
      </mat-error>
      <mat-error *ngIf="form.get('item').hasError('min')">
        {{'Validator.min'|translate:form.get('item').getError('min')}}
      </mat-error>
      <mat-error *ngIf="form.get('item').hasError('isInt')">
        {{'Validator.isInt'|translate}}
      </mat-error>
    </mat-form-field>

    <mat-form-field>
      <input [placeholder]="'LineMachine.spindleNum'|translate" formControlName="spindleNum" matInput required type="number">
      <mat-error *ngIf="form.get('spindleNum').hasError('required')">
        {{'Validator.required'|translate}}
      </mat-error>
      <mat-error *ngIf="form.get('spindleNum').hasError('min')">
        {{'Validator.min'|translate:form.get('spindleNum').getError('min')}}
      </mat-error>
      <mat-error *ngIf="form.get('spindleNum').hasError('isInt')">
        {{'Validator.isInt'|translate}}
      </mat-error>
    </mat-form-field>

  </mat-dialog-content>

  <mat-dialog-actions align="end">
    <button [disabled]="form.pristine||form.invalid" color="primary" mat-button>{{'Common.finish'|translate}}</button>
  </mat-dialog-actions>
</form>
